/*************************************************
 * File:    		SMtype.h.cpp
 * Author:  	HouJiong <hou_jiong@163.com>
 * Brief:   		StoneMoneky project.
 *
 * Copyright (c) HouJiong
 *
 *************************************************/

/*
 * History:
 * =======================================
 * 2009-04-10 HouJiong <hou_jiong@163.com> created
 */
 
#ifndef _SMTYPEDEF_H_
#define _SMTYPEDEF_H_

#include "stdio.h"
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>  

#include <libxml/parser.h>
#include <libxml/tree.h>

#define _DEBUG 1

#ifdef _DEBUG
#define DEBUG_LINE() {\
	 	std::cout<<__FILE__<<" "<<__FUNCTION__<<" "<<__LINE__<<std::endl;}
#define DEBUG_ERROR() {\
	 	std::cout<<"Error:"<<__FILE__<<" "<<__FUNCTION__<<" "<<__LINE__<<std::endl;}
#define DEBUG(s) { \
        std::cout<<s<<std::endl;}
#else
#define DEBUG(s) {}
#define DEBUG_LINE() {}
#endif


template <class T> 
static std::string ConvertToString(T value) 
{
 	std::stringstream ss;
  	ss << value;
  	return ss.str();
}

static std::string xmlPropToString(xmlNode *nod ,xmlChar *name)
{

	xmlChar *tempxmlchar=NULL;

	tempxmlchar=xmlGetProp(nod, name);
	
	if(tempxmlchar)
	{
		return ConvertToString((char *)tempxmlchar);
	}

	return "NULL";
}



#endif//_SMTYPEDEF_H_
